package modellstadt.testapplets;

import processing.core.PApplet;

import java.util.ArrayList;

import modellstadt.geom.Face;
import modellstadt.geom.FaceQuad;
import modellstadt.util.ProcessingUtil;
import peasy.PeasyCam;
import processing.core.PMatrix3D;
import processing.core.PVector;

public class TestSplitGrid extends PApplet {

	FaceQuad quad;
	PeasyCam cam;

	public void setup() {
		size(800, 600, P3D);
		quad = new FaceQuad(new PVector(-100, 0, -100), new PVector(200, 0,
				-100), new PVector(100, 0, 100), new PVector(-100, 0, 100));
		cam = new PeasyCam(this, 300);
	}

	public void draw() {
		background(0);
		ProcessingUtil.drawWorldAxis3D(g, 200);
		fill(255, 0, 0);
		quad.rotateX(0.02f);
		quad.rotateZ(0.01f);
		//quad.display3D(g);
		fill(255);
		ArrayList<Face>faces = quad.split2D(12,6);
		for (int i = 0; i < faces.size(); i++) {
			Face f = faces.get(i);
			f.display3D(g);
		}
		
	}

	
}
